<template>
  <div id="app">
    <form action="javascript:;">
      <input type="text" name="username" v-model.trim="form.username" /><br />

      <input
        type="password"
        name="password"
        v-model.number="form.password"
      /><br />

      <button @click="add">提交</button>
    </form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      form: {
        username: '',
        password: '',
      },
    }
  },
  methods: {
    add() {
      console.log(this.form.username)
      console.log(this.form.password)
    },
  },
}
</script>

<style></style>
